package tech.aistar.service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tech.aistar.mapper.Gedan;
import tech.aistar.pojo.PictureTable;
import tech.aistar.pojo.entity.HotSongList;


import java.util.List;
@Service
@Transactional
public class GedantuServiceImpl implements Gedantu{
    @Autowired
    private Gedan gedan;

    @Override
    public List<PictureTable> selectpicture() {
        return gedan.selectpicture();
    }

    @Override
    public PageInfo<PictureTable> findBypicture(Integer pageNum, Integer pageSize) {
        //设置一些分页的属性
        Page<PictureTable> page = PageHelper.startPage(pageNum,pageSize);
        //定义一个PageInfo
        PageInfo<PictureTable> pageInfo = null;

        List<PictureTable> topics = null;
        topics = gedan.selectpicture();
        pageInfo = new PageInfo<>(topics);
        return pageInfo;

    }

    @Override
    public List<PictureTable> selectbyid(Integer id) {
        List<PictureTable> topics = null;
        topics = gedan.selectbyid(id);
        return topics;
    }

    @Override
    public List<HotSongList> selectpicture1() {
        return gedan.selectpicture1();
    }

    @Override
    public PageInfo<HotSongList> findBypicture1(Integer pageNum, Integer pageSize) {
        //设置一些分页的属性
        Page<HotSongList> page = PageHelper.startPage(pageNum,pageSize);
        //定义一个PageInfo
        PageInfo<HotSongList> pageInfo1 = null;

        List<HotSongList> topics1 = null;
        topics1 = gedan.selectpicture1();
        pageInfo1 = new PageInfo<>(topics1);
        return pageInfo1;
    }

    @Override
    public List<HotSongList> selectbyid1(Integer id) {
        List<HotSongList> topic = null;
        topic = gedan.selectbyid1(id);
        return topic;
    }


}
